package io.mft.runtime.function.combination.predictate;

import io.mft.api.domain.ExecutingResource;
import io.mft.api.domain.Regulation;
import io.mft.plugin.PluginContext;
import io.mft.runtime.function.ApiFunctionResponse;

/**
 * 流程编排接口判别式
 * @说明：TODO
 * @类型名称：ApiFlowPredicate
 * @创建者: 胡常建  
 * @创建时间: 2021年9月17日 下午5:31:49
 * @修改者: 胡常建  
 * @修改时间: 2021年9月17日 下午5:31:49
 */
public abstract class ApiFlowPredicate extends FlowPredicateFunction{
	@Override
	public boolean test(PluginContext<ExecutingResource<Regulation>> t) {
		/**
		KVMap config=t.getValue().getExecutingRegulation().getConfig();
		String currentRuningCombinationRegulationUniqueId=config.getString("currentRuningCombinationRegulationUniqueId", "");
		String currentRuningCombinationApiKey=config.getString("currentRuningCombinationApiKey", "");
		
		if (ObjectUtil.isEmpty(currentRuningCombinationRegulationUniqueId)) {
			throw new MFTException("流程编排判别式执行API接口未配置,请检查接口元数据[predicateApi]");
		}
		ApiFunctionRequest request=new ApiFunctionRequest(t.getRequest().getRequestValue());
		ApiFunctionResponse response=new ApiFunctionResponse();
		ExecuteReturn executeReturn=MFTApiExecutor.getInstance().execute(predicateApi, request, response);
		if (executeReturn.getCode()==0) {
			return process(t, response);
		}else {
			return false;
		}**/
		return true;
	}

	protected abstract boolean process(PluginContext<ExecutingResource<Regulation>> context,ApiFunctionResponse response) ;
	
	
}
